package pe.gob.mimp.model;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

@Entity
@Table(name = "PERFIL")
@NamedQueries({ @NamedQuery(name = "Perfil.findAll", query = "SELECT p FROM Perfil p") })
public class Perfil implements Serializable {
	private static final long serialVersionUID = 1L;
	@Id
	@Basic(optional = false)
	@Column(name = "ID_PERFIL")
	private Long idPerfil;
	@Column(name = "DESCRIPCION")
	private String descripcion;
	@ManyToMany(mappedBy = "perfilList")
	private List<Menu> menuList;

	public Perfil() {
	}

	public Perfil(Long idPerfil) {
		this.idPerfil = idPerfil;
	}

	public Long getIdPerfil() {
		return idPerfil;
	}

	public void setIdPerfil(Long idPerfil) {
		this.idPerfil = idPerfil;
	}

	public String getDescripcion() {
		return descripcion;
	}

	public void setDescripcion(String descripcion) {
		this.descripcion = descripcion;
	}

	public List<Menu> getMenuList() {
		return menuList;
	}

	public void setMenuList(List<Menu> menuList) {
		this.menuList = menuList;
	}

	@Override
	public int hashCode() {
		int hash = 0;
		hash += (idPerfil != null ? idPerfil.hashCode() : 0);
		return hash;
	}

	@Override
	public boolean equals(Object object) {
		// TODO: Warning - this method won't work in the case the id fields are
		// not set
		if (!(object instanceof Perfil)) {
			return false;
		}
		Perfil other = (Perfil) object;
		if ((this.idPerfil == null && other.idPerfil != null)
				|| (this.idPerfil != null && !this.idPerfil
						.equals(other.idPerfil))) {
			return false;
		}
		return true;
	}

	@Override
	public String toString() {
		return "pe.gob.mimp.model.Perfil[ idPerfil=" + idPerfil + " ]";
	}

}
